package git.determinal.template.view;




import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import io.swagger.annotations.ApiModel;
import java.util.ArrayList;
import java.util.Collection;

@ApiModel("多个排序参数")
@JsonInclude(Include.ALWAYS)
public class OrderParams<T> {
    private Collection<OrderField> orders;

    public OrderParams() {
        this.orders = new ArrayList();
    }

    public OrderParams<T> orderBy(String fieldName, String sort) {
        OrderField field = new OrderField(fieldName, sort);
        this.orders.add(field);
        return this;
    }

    public Collection<OrderField> getOrders() {
        return this.orders;
    }

    public void setOrders(final Collection<OrderField> orders) {
        this.orders = orders;
    }

    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof OrderParams)) {
            return false;
        } else {
            OrderParams<?> other = (OrderParams)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                Object this$orders = this.getOrders();
                Object other$orders = other.getOrders();
                if (this$orders == null) {
                    if (other$orders != null) {
                        return false;
                    }
                } else if (!this$orders.equals(other$orders)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(final Object other) {
        return other instanceof OrderParams;
    }

    public int hashCode() {
        boolean PRIME = true;
        int result = 1;
        Object $orders = this.getOrders();
        result = result * 59 + ($orders == null ? 43 : $orders.hashCode());
        return result;
    }

    public String toString() {
        return "OrderParams(orders=" + this.getOrders() + ")";
    }

    public OrderParams(final Collection<OrderField> orders) {
        this.orders = orders;
    }
}



